package config

import "github.com/spf13/viper"

type Server struct {
	Post int
}
type Mysql struct {
	Dsn string
}
type Config struct {
	Server
	Mysql
}

var AppConfig Config

func Init() (*Config, error) {
	viper.SetConfigFile("config./config.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		return nil, err
	}
	err = viper.Unmarshal(&AppConfig)
	if err != nil {
		return nil, err
	}
	return &AppConfig, nil
}
